package cn.chainco.cts.iserviceImpl;

import java.util.List;

import cn.chainco.cts.idao.ICurrencyDao;
import cn.chainco.cts.iservice.ICurrencyManager;
import cn.chainco.cts.jdo.Currency;

public class CurrencyManagerImpl extends CommonManagerImpl implements ICurrencyManager{
	private ICurrencyDao currencyDao;

	public ICurrencyDao getCurrencyDao(){
		return currencyDao;
	}

	public void setCurrencyDao(ICurrencyDao currencyDao){
		this.currencyDao = currencyDao;
	}

	/**
	 * 根据货币名称查找(CNY)
	 */
	public Currency findByName(String name){
		List<Currency> list = currencyDao.findByName(name);
		if(!list.isEmpty()){
			return list.get(0);
		}
		return null;
	}

	/**
	 * 根据货币名称查找(人民币元)
	 */
	public Currency findByCnName(String cnname){
		return currencyDao.findByCnName(cnname);
	}

	/**
	 * 取所有币种
	 */
	public List<Currency> getAllCurrency(){
		return this.currencyDao.getAllCurrency();
	}
}
